-
Notifications
You must be signed in to change notification settings - Fork 45
test indexing with arrays #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e4262e3
to
bf9ed3f
Compare
I think the main way to test correctness is to assert each element corresponds to indexing the individual element of the index array. This would make the test unvectorized, though. For a vectorized test the only thing I can think of is to flatten things and test that it matches As far as mixed indices, ndindex can help by canonicalizing the index (you want the |
Run the (current, hacky) test on dask: it does not seem to allow array indexing.
|
bf9ed3f
to
ba9489a
Compare
Thanks @asmeurer ! |
cross-ref #343 for a cleaner but slightly more restricted test (which only generates 1D indexing arrays) |
closing in favor of #343 |
cross-ref data-apis/array-api#669 : test indexing arrays objects with a mix of integers and arrays.
ndindex
library that would help. Could you weight in @asmeurer?__setitem__
in addition to getitem?As a data point, the current (hacky) test seems to pass locally with numpy (unsurprisingly), pytorch and jax.numpy.
EDIT: also passes locally with array-api-strict, patched via https://github.com/data-apis/array-api-strict/compare/main...ev-br:array_indexing?expand=1 (the patch certainly allows way too much, is for demo purposes only).
A CLI incantation to run tests locally
cc @kgryte for viz